how to not have memory leaks in c